var id= GetQueryString("id");
$(function () {
    $("#jqGrid").jqGrid({
        url: baseURL + 'client/manager/maintain?id='+id,
        datatype: "json",
        colModel: [			
			//{ label: 'id', name: 'id', index: 'id', width: 50, key: true },
			{ label: '报修编号', name: 'mainTainCode', index: 'maintain_code', width: 80,align:'center',sortable:false }, 			
			{ label: '报修类型', name: 'mainTainType', index: 'main_tainType', width: 80,align:'center',sortable:false,
				formatter:function(value,options,rowObject){
					if(value==1){
						return "图书报修";
					}else if(value==2){
						return "书格报修";
					}else if(value==3){
						return "书柜报修";
					}
				}
			}, 			
			{ label: '报修内容', name: 'describe', index: 'describe', width: 80,align:'center',sortable:false }, 			
			{ label: '报修时间', name: 'createTime', index: 'create_time', width: 80,align:'center',sortable:false } 			
        ],
		viewrecords: true,
        height: 385,
        rowNum: 10,
		rowList : [10,30,50],
        rownumbers: true, 
        rownumWidth: 25, 
        autowidth:true,
        multiselect: true,
        pager: "#jqGridPager",
        jsonReader : {
            root: "page.list",
            page: "page.currPage",
            total: "page.totalPage",
            records: "page.totalCount"
        },
        prmNames : {
            page:"page", 
            rows:"limit", 
            order: "order"
        },
        gridComplete:function(){
        	//隐藏grid底部滚动条
        	$("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" }); 
        }
    });
});

var vm = new Vue({
	el:'#rrapp',
	data:{
		q:{
			mainTainStartTime:null,
			mainTainEndTime:null
        },
		showList: true,
		title: null,
		capitalRecord: {}
	},
	methods: {
		query: function () {
			vm.reload();
		},
		reload: function (event) {
			vm.showList = true;
			var page = $("#jqGrid").jqGrid('getGridParam','page');
			$("#jqGrid").jqGrid('setGridParam', {
				postData : {
					'id':id,
					'mainTainStartTime' : vm.q.mainTainStartTime,
					'mainTainEndTime' : vm.q.mainTainEndTime
				},
				page : page
			}).trigger("reloadGrid");
		}
	}
});